<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

 <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">

<title>Insert title here</title>


<script type="text/javascript">
$.datepicker.setDefaults({
    dateFormat: 'yy-mm-dd'
});
$(function() {
    $( "#datepicker1" ).datepicker();
  });
  
$(function() {
    $( "#datepicker2" ).datepicker();
  });


	function searchFn()
	{
		var frm=document.frm01;
		frm.action = "PDT1010M1.do";
		frm.target="_self";
		frm.submit();
	}
	
	function pageing(page){
		var frm=document.frm01;
		frm.action = "PDT1010M1.do?page="+page;
		frm.target="_self";
		frm.submit();
	}
	
	function openDetailFn(num)
	{
		var frm=document.frm02;
		var title  = "testpop";
		var status = "toolbar=no,directories=no,scrollbars=no,resizable=no,status=no,menubar=no,width=1000, height=600, top=0,left=20"; 
		frm.target = title;    
		window.open("window", title,status); 
		frm.action = "PDT1020P1.do?productNumber="+num; 
		frm.submit();
	}
	function openDetailFn2(num)
	{
		var frm=document.frm02;
		var title  = "testpop2";
		var status = "toolbar=no,directories=no,scrollbars=no,resizable=no,status=no,menubar=no,width=1000, height=600, top=0,left=20"; 
		frm.target = title;    
		window.open("", title,status); 
		frm.action = "PDT1020P12.do?productNumber="+num; 
		frm.submit();
	}
	
	function openJoinFn()
	{
		var frm=document.frm01;
		var title  = "testpop1";
		var status = "toolbar=no,directories=no,scrollbars=no,resizable=no,status=no,menubar=no,width=1000, height=600, top=0,left=20"; 
		frm.target = title;    
		window.open("", title,status); 
		frm.action = "PDT1020P1.do";
		frm.submit();
	}
	
</script>
<style>
.ui-datepicker{ font-size: 12px; width: 160px; }
.ui-datepicker select.ui-datepicker-month{ width:30%; font-size: 11px; }
.ui-datepicker select.ui-datepicker-year{ width:40%; font-size: 11px; }
</style>
</head>
<body>

	<form name="frm01" method="post">
		<center>
			<table border="1" rules="none" cellspacing="0" cellpadding="5" width="80%">
				<tr>
					<td colspan="4"><font size="2">판매일자</font></td>
					<td colspan="3"><font size="2">상품명</font></td>
				</tr>
				<tr>
					<td width=""><input id="datepicker1" name="sellStartDate1" type=text value="${sellStartDate1}"  readonly="readonly"></td>
					<td></td>
					<td width=""><input id="datepicker2" name="sellStartDate2" type=text value="${sellStartDate2}" readonly="readonly"></td>
					<td></td>
					<td width=""><input name="productName" type=text value="${productName}"></td>
					<td><input type=button name="search" value="조회" onclick="javascript:searchFn()"></td>
					<td align="right" width="300px"><input name="openjoin" type=button onclick="javascript:openJoinFn()" value="신규등록"></td>
				</tr>
			</table>
		</center>
	</form>
	<table>
		<tr>
		</tr>
	</table>
	<form name="frm02" method="post">
		<center>
		<table border="1"  rules="all" width="80%" >
			<tr height="30">
				<td align="center" width="80" ><font size="1">상품코드</font></td>
				<td align="center" width="80"><font size="1">상품명</font></td>
				<td align="center" width="80"><font size="1">품목코드</font></td>
				<td align="center" width="100"><font size="1">품목명</font></td>
				<td align="center" width="80"><font size="1">제조사</font></td>
				<td align="center" width="100"><font size="1">카테고리명</font></td>
				<td align="center" width="100"><font size="1">규격</font></td>
				<td align="center" width="80"><font size="1">단위</font></td>
				<td align="center" width="100"><font size="1">단가</font></td>
				<td align="center" width="80"><font size="1">주담당자</font></td>
				<td align="center" width="100"><font size="1">판매개시일자</font></td>
				<td align="center" width="100"><font size="1">판매종료일자</font></td>
				<td align="center" width="100"><font size="1">조회</font></td>
			</tr> 
			<c:forEach  var="productList"  items="${list}" >
				<tr height="20">
					<td align="center"><font size="1"><a href="#" onclick="openDetailFn(${productList.productNumber})">${productList.productCode}</a></font></td>
					<td align="center"><font size="1"><a href="#" onclick="openDetailFn(${productList.productNumber})">${productList.productName}</a></font></td> 
					<td align="center"><font size="1">${productList.itemCode}</font></td> 
					<td align="center"><font size="1">${productList.itemName}</font></td>
					<td align="center"><font size="1">${productList.companyName}</font></td>
					<td align="center"><font size="1">${productList.categoryName}</font></td>
					<td align="center"><font size="1">${productList.productSize}</font></td>
					<td align="center"><font size="1">${productList.unitMasure}</font></td>
					<td align="center"><font size="1">${productList.unitPrice}</font></td>
					<td align="center"><font size="1">${productList.employeeName}</font></td>
					<td align="center"><font size="1">${productList.sellStartDate}</font></td>
					<td align="center"><font size="1">${productList.sellStopDate}</font></td>
					<td align="center"><input type="button" name="infoDetail" onclick="openDetailFn2(${productList.productNumber})" value="조회"></td>
				</tr>
			</c:forEach>
				<tr>
					<td colspan="13" align="center">
						<c:forEach var="a" begin="${startpage}" end="${maxpage }">
							<c:if test="${a==page}">[${a }]</c:if>
							<c:if test="${a!=page}">
								<a href="#" onclick="pageing(${a})">${a }</a>&nbsp;</c:if>
						</c:forEach>
					</td>
				</tr>
			</table>
		</center>
	</form>
	${msg}
</body>
</html>